﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;

namespace AGMLite.Common
{
    public class AGMLiteEnum
    {
        public enum EntityType {Requirement, Defect, ProjectTask}
        public enum Operation {Equals, NotEquals, Contain, NotContain,  StartWith, LargerThan, LargerThanEquals, SmallerThan, SmallerThanEquals}

        public static ObservableCollection<string> GetEnumValues(Type enumType)
        {
            ObservableCollection<string> itemList = new ObservableCollection<string>();

            var listOfValues = Enum.GetValues(enumType);
            foreach (var value in listOfValues)
            {
                itemList.Add(value.ToString());
            }

            return itemList;
        }

        public static string GetEntityTypeFromEnum(EntityType et)
        {
            string entity = null;
            switch (et)
            {
                case Common.AGMLiteEnum.EntityType.Requirement:
                    entity = "requirement";
                    break;
                case Common.AGMLiteEnum.EntityType.ProjectTask:
                    entity = "project-task";
                    break;
                case Common.AGMLiteEnum.EntityType.Defect:
                    entity = "defect";
                    break;
            }

            return entity;
        }

        public static EntityType GetEntityTypeFromString(string entitytype)
        {
            switch (entitytype)
            {
                case "requirement":
                    return Common.AGMLiteEnum.EntityType.Requirement;
                case "project-task":
                    return Common.AGMLiteEnum.EntityType.ProjectTask;
                case "defect":
                    return Common.AGMLiteEnum.EntityType.Defect;
            }

            return EntityType.Requirement;
        }
    }
}
